<template>
  <el-dialog title="直播数据" :visible.sync="visible" :before-close="handleClose" width="100%">
    <div class="block-header">
      <div class="blue_title">用户流</div>
      <div class="livedata_content">
        <!-- <div class="item">
          <p>预约人数</p>
          <p>{{data.subscribePerson || 0}}</p>
        </div> -->
        <div class="item">
          <p>观看人数</p>
          <p>{{data.viewsPerson || 0}}</p>
        </div>
        <div class="item">
          <p>新增用户</p>
          <p>{{data.addPerson}}</p>
        </div>
        <div class="item">
          <p>观看人次</p>
          <p>{{data.viewsNum || 0}}</p>
        </div>
        <div class="item">
          <p>人均观看时长</p>
          <p>{{data.viewsTime / 1000}}秒</p>
        </div>
        <div class="item">
          <p>最大在线人数</p>
          <p>{{data.maxPerson || 0}}</p>
        </div>
      </div>
    </div>
    <div class="block-header">
      <div class="blue_title">直播互动</div>
      <div class="livedata_content">
        <div class="item">
          <p>评论人数</p>
          <p>{{data.commentPerson}}</p>
        </div>
        <div class="item">
          <p>评论数</p>
          <p>{{data.commentNum}}</p>
        </div>
        <div class="item">
          <p>点赞数</p>
          <p>{{data.likeNum || 0}}</p>
        </div>
        <div class="item">
          <p>点赞人数</p>
          <p>{{data.likePerson || 0}}</p>
        </div>
        <div class="item">
          <p>关注数</p>
          <p>{{data.followPerson}}</p>
        </div>
        <div class="item">
          <p>取关人数</p>
          <p>{{data.unfollowPerson}}</p>
        </div>
        <div class="item">
          <p>分享人数</p>
          <p>{{data.sharePerson}}</p>
        </div>
        <div class="item">
          <p>分享次数</p>
          <p>{{data.shareNum}}</p>
        </div>
      </div>
    </div>
    <div class="block-header">
      <div class="blue_title">交易转换</div>
      <div class="livedata_content">
        <div class="item">
          <p>商品SKU</p>
          <p>{{data.goodsNum || 0}}</p>
        </div>
        <div class="item">
          <p>加购人数</p>
          <p>{{data.addPayPerson || 0}}</p>
        </div>
        <div class="item">
          <p>加购次数</p>
          <p>{{data.addPayNum || 0}}</p>
        </div>
        <div class="item">
          <p>支付人数</p>
          <p>{{data.payPerson || 0}}</p>
        </div>
        <div class="item">
          <p>订单支付数</p>
          <p>{{data.payNum || 0}}</p>
        </div>
        <div class="item">
          <p>客单价</p>
          <p>{{data.unitPrice || 0}}</p>
        </div>
        <div class="item">
          <p>GMV</p>
          <p>{{data.gmv || 0}}</p>
        </div>
      </div>
    </div>
    <div class="block-header">
      <div class="blue_title">回放数</div>
      <div class="livedata_content">
        <div class="item">
          <p>观看人数</p>
          <p>{{data.playbackPerson}}</p>
        </div>
        <div class="item">
          <p>观看人次</p>
          <p>{{data.playbackNum}}</p>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'bzb-liveData',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    data: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {}
  },
  methods: {
    handleClose() {
      this.$emit('update:visible', false)
    }
  }
}
</script>

<style lang="scss" scoped>
.block-header {
  color: #333;
  font-size: 14px;
  padding: 12px 0;
  margin-bottom: 12px;
  background: #f7f7f7;
  .red_title,
  .blue_title {
    padding: 0 12px;
    margin-bottom: 10px;
  }
  .red_title {
    border-left: 2px solid red;
  }
  .blue_title {
    border-left: 2px solid #409eff;
  }
}
.livedata_content {
  display: flex;

  .item {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-left: 10px;
    text-align: center;
    line-height: 1.3;
  }
}
</style>